package com.demo.jpa.dao.entity;

import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * @Author:LiaoYouLe
 * @Date: Created in 2018/7/25
 * @Description
 * @Modifyied By:
 */
@Entity
@NamedStoredProcedureQuery(
        name = "User.age",
        procedureName = "query_age",
        parameters = {
                @StoredProcedureParameter(mode = ParameterMode.IN, name = "arg", type = Integer.class),
                @StoredProcedureParameter(mode = ParameterMode.OUT, name = "res", type = Integer.class)
        }
)
@Getter
@Setter
public class UserProcedureEntity {
    @Id
    private Integer uid;
    private String username;
    private Integer age;


    @Override
    public String toString() {
        JSONObject jsonToString = new JSONObject();
        jsonToString.put("useranme", username);
        jsonToString.put("age", age);
        return jsonToString.toJSONString();
    }
}
